package com.mycontact.client.mapper;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.mycontact.client.activity.MainPanelEditContactActivity;
import com.mycontact.client.activity.MainPanelViewContactActivity;
import com.mycontact.client.place.EditContactPlace;
import com.mycontact.client.place.ViewContactsPlace;
import com.mycontact.client.ClientFactory;

public class MainPanelActivityMapper implements ActivityMapper {
	private ClientFactory clientFactory;
	
	public MainPanelActivityMapper(ClientFactory clientFactory) {
		super();
		this.clientFactory = clientFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof EditContactPlace)
			return new MainPanelEditContactActivity((EditContactPlace) place, clientFactory);
		else if (place instanceof ViewContactsPlace)
			return new MainPanelViewContactActivity(clientFactory);
		return null;
	}

}
